﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Factory
{
    public class Utils
    {
        public static void LimpaCampos(Control controle)
        {
            foreach (Control ctle in controle.Controls)
            {
                if (ctle is TextBox)
                {
                    ((TextBox)ctle).Text = string.Empty;
                }

                if (ctle is RadioButton)
                {
                    ((RadioButton)ctle).Checked = false;
                }

                if (ctle is MaskedTextBox)
                {
                    ((MaskedTextBox)ctle).Text = string.Empty;
                }

                if (ctle is ComboBox)
                {
                    ((ComboBox)ctle).SelectedIndex = 0;
                }

                else if (ctle.Controls.Count > 0)
                {
                    LimpaCampos(ctle);
                }
            }
        }
    }
}
